package com.xinfan.mhl.service;

import com.xinfan.mhl.dao.MenuDao;
import com.xinfan.mhl.domain.Menu;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import java.util.List;

/**
 * @Author xin
 * @Date 2022/6/23 20:22
 * @Version 1.0
 */
public class MenuService {
    private MenuDao menuDao = new MenuDao();

    /**
     * @description: 获取菜单信息
     * @params: []
     * @return: java.util.List<com.xinfan.mhl.domain.Menu>
     * @author: xin
     * @dateTime: 2022/6/23 20:27
     */
    public List<Menu> getMenus() {
        return menuDao.selectMany("select * from menu",Menu.class);
    }

    /**
     * 根据id获取menu对象
     * @param menuId
     * @return Menu
     */
    public Menu getMenuById(int menuId) {
        return menuDao.selectOne("select * from menu where id = ?",Menu.class,menuId);
    }
}
